import createDomELement from "./createDomELement";
import mountElement from "./mountElement";
import unmountNode from "./unmountNode";
export default function mountNativElement (virtualDom , container, oldDom) {
  let newElement = createDomELement(virtualDom)
  // 旧元素存在就删除
  if (oldDom) {
    unmountNode(oldDom)
  }
  // 把转换后的DOM放置到页面上
  container.appendChild(newElement)

  let component = virtualDom.component
  if (component) {
    component.setDom(newElement)
  }
}